package com.GroupSix.controller;


import com.GroupSix.service.StudentService;
import com.GroupSix.service.TeacherService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.websocket.server.PathParam;

@Slf4j
@RestController
@RequestMapping("/login")
public class LoginController {

    //注入学生接口
    @Autowired
    private StudentService studentService;

    //注入教师接口
    @Autowired
    private TeacherService teacherService;

    //学生用户登录
    @PostMapping("/studentLogin")
    public String studentLogin(@PathParam("name") String name, @PathParam("id") Integer id, @PathParam("pwd") String pwd){
        return studentService.login(name, id, pwd);
    }

    //教师用户登录
    @PostMapping("/teacherLogin")
    public String teacherLogin(@PathParam("name") String name, @PathParam("id") Integer id, @PathParam("pwd") String pwd){
        return teacherService.login(name, id, pwd);
    }
}
